<template>
  <h1>
    grandSon 组件
    <h2>来自 grandFather de 数据 {{temp}}</h2>

    <!-- <h2>来自 grandFather de 数据 {{msgObj.msg}}</h2> -->
    <button @click="changFatherData">在后代组件中修改父级组件的数据</button>
    <hr>
    <div>{{ msgObj }}</div>
  </h1>
</template>
<script setup>
import { inject } from 'vue';
import { msgKey } from '@/utils/symbolKeys';
defineProps(['temp'])

// 注入
// const msg = inject('msg')

// Symbol
const msgObj = inject(msgKey)

const changFatherData = ()=>{
  // msg.value='你好'
  msgObj.changMsg()
  // msgObj.msg.value = 'nihao'
}
</script>